<?php

namespace App\Modules\Apicrzs\Http\Requests;

use App\Modules\Apicrzs\Entities\UsersModel;

class RetrieveRequest extends BaseRequest
{
    public function setInstance()
    {
        $this->instance = UsersModel::getInstance();
    }
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'phone' =>[
                'required',
                'max:11',
                'unique:' . $this->instance->getTable() . ',username' . $this->validate_id,
                'unique:' . $this->instance->getTable() . ',mobile' . $this->validate_id
            ],
            'captcha'   => 'required',
        ];
    }

    public function messages()
    {
        return [
            'phone.required' => '请填写手机号！',
            'phone.max'      => '手机格式不正确！',
            'phone.unique'      => '当前手机号已！',
            'account.unique'      => '当前手机号已绑定！',
            'captcha.required'      => '请填写验证码！',
        ];
    }
}
